#include "util.h"
#include "common_sort.h"


int main(int argc, char * argv[]) {
	// srand seed
	srand(time(NULL));

	int testTime = 50;
	int maxSize = 100;
	int maxValue = 100;
	bool succeed = true;

	int startTime = time(NULL);

	for (int i = 0; i < testTime; ++i) {
		std::vector<int> vec1 = util::generateRandomArray(maxSize, maxValue);
		std::vector<int> vec2 = util::copyArray(vec1);

		// BubbleSort::sort(vec1);
		// InsertionSort::sort(vec1);
		// SelectionSort::sort(vec1);
		// ShellSort::sort(vec1);
		// MergeSort::sort(vec1);
		// HeapSort::sort(vec1);
		// QuickSort::sort(vec1);
		// RecursiveBubbleSort::sort(vec1, vec1.size());
		// RecursiveInsertionSort::sort(vec1, vec1.size());
		// IterativeMergeSort::sort(vec1);
		CombSort::sort(vec1);
		IterativeQuickSort::sort(vec1);
		util::comparator(vec2);
		if (!util::isEqual(vec1, vec2)) {
				succeed = false;
				std::cout << "vec1:" << std::endl;
				util::print(vec1);
				std::cout << "vec2:" << std::endl;
				util::print(vec2);
				break;
		}
	}

	/*
	// std::vector<int> vec1 = {1,3,5,4,2,7,6};
	// IterativeQuickSort::sort(vec1);
	// CountingSort::sort(vec1);
	std::vector<int> vec1 = {8, 4, 1, 56, 3, -44, 23, -6, 28, 0};
	// RadixSort::sort(vec1);
	CombSort::sort(vec1);
	std::cout << "vec1:" << std::endl;
	util::print(vec1);
	*/

	std::cout << (succeed ? "Nice!" : "Fucking fucked!") << std::endl;
	std::cout << "elapse: " << time(NULL) - startTime << std::endl;
	return 1;
}

